<?php

namespace Home\Model;

/**
 * Description of ArticleModel
 *
 * @author 阿明 symphp@foxmail.com
 */
class ArticleModel extends \Think\Model{
    public function getHelpArticleList(){
        //1.获取分类列表
        $help_categories = D('ArticleCategory')->where(['is_help'=>1,'status'=>1])->limit(5)->getField('id,name');
        //2.获取文章列表
        foreach($help_categories as $key=>$value){
            $data = [
            'name'=>$value,
            'list' => $this->field('id,name')->where(['status'=>1,'article_category_id'=>$key])->limit(6)->select(),
            ];
            $helpArticle[$key] = $data;  
        }
        //3.组成一个数组返回
        return $helpArticle;
    }
    }  
       
